#include <stdio.h>
#include <stdlib.h>

void* emalloc(size_t size) {
	void *ptr;

	ptr = malloc(size);

	if (ptr == NULL) {
		fprintf(stderr,
		        "FATAL ERROR: failed to allocate memory.");
		exit(EXIT_FAILURE);
	}

	return ptr;
}

void* erealloc(void *ptr, size_t size) {
	ptr = realloc(ptr, size);

	if (ptr == NULL) {
		fprintf(stderr,
		        "FATAL_ERROR: failed to reallocate memory.");
		exit(EXIT_FAILURE);
	}

	return ptr;
}
